import React, { Component } from 'react'
import CommentItem from '../comment-item/comment-item'
import PubSub from 'pubsub-js'
import "./comment-list.css"
export default class CommentList extends Component{
    constructor (props) {
        super(props)
        this.state={
            
        }
    }
    componentDidMount(){
        PubSub.subscribe('thisPubSubmsg',(msg,data)=>{
            console.log(msg)
            console.log(data)
        })
    }
    render(){
        let commentList = this.props.commentList
        return (
            <div className="listbox">
                <h4>评论回复：</h4>
                
                {
                  commentList.map((item,index)=>{
                      return <CommentItem item={item} key={item.id} index={index}></CommentItem>
                  })  
                }
            </div>
        )
    }
}